﻿/*
 * Created by SharpDevelop.
 * User: IEscarro
 * Date: 8/27/2009
 * Time: 4:31 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using Microsoft.Win32;

namespace Miming.Util
{
	/// <summary>
	/// Description of RegistryUtility.
	/// </summary>
	public class RegistryUtility
	{
		public static string LocalMachineSubKey {
			get { return "Software\\Bogetz Global Solutions Corp\\Miming"; }
		}
		
		public static string CurrentUserSubKey {
			get { return "Bogetz Global Solutions Corp\\Miming"; }
		}
		
		public RegistryUtility()
		{
		}
		
		public static RegistryKey CheckCurrentUserRegistry()
		{
			if (Registry.CurrentUser.CreateSubKey(CurrentUserSubKey) ==  null) {
				Registry.CurrentUser.CreateSubKey(CurrentUserSubKey);
			}
			return Registry.CurrentUser.CreateSubKey(CurrentUserSubKey);
		}
		
		public static RegistryKey CheckLocalMachineRegistry()
		{
			if (Registry.LocalMachine.CreateSubKey(LocalMachineSubKey) ==  null) {
				Registry.LocalMachine.CreateSubKey(LocalMachineSubKey);
			}
			return Registry.LocalMachine.CreateSubKey(LocalMachineSubKey);
		}
		
		public static void SetCurrentUserValue(string key, object val)
		{
			RegistryKey k = CheckCurrentUserRegistry();
			k.SetValue(key, val);
		}
		
		public static object GetCurrentUserValue(string key)
		{
			RegistryKey k = CheckCurrentUserRegistry();
			return k.GetValue(key);
		}
		
		public static void SetLocalMachineValue(string key, object val)
		{
			RegistryKey k = CheckLocalMachineRegistry();
			k.SetValue(key, val);
		}
	}
}
